Config Api
API for management of config files. If writing in Java, consider using ConfigApiJava where possible.
Configs can de/serialized from File, string, or raw TomlElement. File read/write is performed with validation and correction.
The wiki has several articles related to using and designing configs
Author
fzzyhmstrs
Since
0.1.0
Functions
Applies a set of translations for the provided class object to the provided builder. Uses Translatable.Name, Translatable.Desc, and Translatable.Prefix annotations to power the generation. TomlComment and Comment can be used to provide en_us description lang.
Deserializes a config from a string.
Deserializes a config class from a TomlElement
Whether a config corresponding to the provided scope is registered
Returns whether a config corresponding to the provided scope has been loaded or not, on the specified load side.
Determines if a Config GUI is open currently.
Provides an instance of the NetworkApi for usage of the built-in cross-loader networking API
Opens a config GUI. Does nothing on the server (But is not marked with @Environment, allowing for safe inclusion anywhere in code)
Parses a resource reader into a TomlElement for use in Codecs or other things.
Provides an instance of the PlatformApi for usage of the built-in cross-loader utilities
overload of readOrCreateAndValidate that automatically applies the name, folder, and subfolder from the config itself. Automatically adds ".toml" to the name for reading and writing.
Reads a config from File or Creates a new config class; writes out any corrections, updates, or new content to File. Automatically adds ".toml" to the name for reading and writing.
Creates and registers a Config. Use this over registerConfig and readOrCreateAndValidate if possible.
Creates and registers a Config. Use this over registerConfig and readOrCreateAndValidate if possible.
Registers a Config to registries. Does NOT load or validate it from file. Use this if you have custom initialization to perform, otherwise use registerAndLoadConfig for full initialization functionality.
Registers a ConfigScreenProvider to the client config registry. This provider will have priority over the default screen manager if it provides a non-null screen or successfully opens its own screen.
Serializes a config class to a string.
Serialize a config class to a TomlElement